home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-10-15 | 1.3 KB | 47 lines | [TEXT/MPS ] |
- #
- # File: MouseChaos.vu
- #
- # Contains: A very simple VU script that illustrates the use of the system tasks
- # random(), and mouseSpeed(). Simply run it against any target machine.
- # The theSeed variable sets the random seed used when creating a random
- # number. To repeat a series of random numbers, set the theSeed parameter
- # to the same value as a pervious test.
- #
- # Conventions: Global variables begin with a "g"
- #
- # Written by: Jay Jessen
- #
- # Copyright: © 1990-1992 by Apple Computer, Inc., all rights reserved.
- #
- # Change History (most recent first):
- #
- # <4> 12/3/92 RV
- # 8/19/92 DGG Made into parametric script. Included use of RandomSeed
- # 7/7/92 DGG Clean up for VU 2.0
- # 5/17/90 JAS Create globals numberOfMoves and maxMouseSpeed. A few small
- # changes in comment header.
- #
- # 11/7/89 Jay creation
- #
- # To Do:
- #
-
- script MouseChaosMain(gNumberOfMoves := 20, gMaxMouseSpeed := 20, theSeed )
- begin
- if IsUndefined(theSeed)
- theSeed := Random();
- println "The random seed is ",theSeed;
- RandomSeed(theSeed);
-
- match [screen m:true r:?Screen_rect]!;
- xHi := Screen_rect[3];
- yHi := Screen_rect[4];
- for i := 1 to gNumberOfMoves
- begin
- MouseSpeed(random(0,gMaxMouseSpeed));
- x := random(,xHi);
- y := random(,yHi);
- println '(',x,',',y,')';
- move a: { x,y };
- end;
- end;